package com.caiyigo.test.arithmetic.simplefactory;

import static org.junit.Assert.*;

import org.junit.Test;

public class test {
	@Test
	public void testCashNormal() throws Exception {
		double total = 0.0d;
		CashSuper cSuper = CashFactory.createCashAccept("正常收费");
		double totalPrices = 0d;
		totalPrices = cSuper.acceptCash(300);
		total = total + totalPrices;
		assertEquals(300.0, total, 0.0);
	}

	@Test
	public void testCashReturn() throws Exception {
		double total = 0.0d;
		CashSuper cSuper = CashFactory.createCashAccept("满300返100");
		double totalPrices = 0d;
		totalPrices = cSuper.acceptCash(300);
		total = total + totalPrices;
		assertEquals(200.0, total, 0.0);
	}

	@Test
	public void testCashRebate() throws Exception {
		double total = 0.0d;
		CashSuper cSuper = CashFactory.createCashAccept("打8折");
		double totalPrices = 0d;
		totalPrices = cSuper.acceptCash(300);
		total = total + totalPrices;
		assertEquals(240.0, total, 0.0);
	}
}
